import os
    

class ProjectFinder:
    '''
    Finds maven projects root dirs
    '''
    
    PROJECT_OBJECT_MODEL = 'pom.xml'
    
    @staticmethod
    def findProjects(rootDir):
        '''
        Finds maven projects within certain root-dir
        '''
        
        projects = []
        
        for path, dirs, files in os.walk(rootDir):
            for fileName in files:
                if fileName == ProjectFinder.PROJECT_OBJECT_MODEL:
                    print("Found project at", path)
                    projects.append(path)
                    
                    # no need to dig deeper into this project
                    del dirs[:]
        
        return projects
